package com.demo.expertsystemdemo.entity.mongodb;


import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
import org.springframework.data.mongodb.core.mapping.MongoId;

import java.time.LocalDateTime;
import java.util.Date;

/**
 * {@code @Document} 可以省略，如果省略，则默认使用类名小写映射集合
 */
@Data
@ToString
@Accessors(chain = true)
@Document(collection = "postInfo")
public class PostInfo {

    /**
     * 主键
     */
    @MongoId
    private String id;
    /**
     * 贴子标题
     */
    @Field("content")
    private String postTitle;
    private Date publishTime;
    /**
     * 添加了一个单字段的索引
     * 索引可以大大提升查询效率，一般在查询字段上添加索引
     */
    @Indexed
    private String userid;
    private String nickname;
    private Date createTime;
    private Integer likeNum;
    private Integer replyNum;
    private String state;


}
